package com.servlet.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Title: MyFilter02
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2023/12/26 9:26
 */
public class MyFilter02 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest)servletRequest;
        HttpServletResponse response = (HttpServletResponse)servletResponse;
        // 在进入到下一个servlet之前执行
        System.out.println("B 过滤器执行了.....");
        // 放行
        filterChain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
